package com.lengmomo.games.controller;

import com.lengmomo.games.service.IChessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author lengmomo
 * @Date 2023/11/8 9:46
 * @Version 1.0
 */
@Controller
@RequestMapping("/chess")
public class ChessController {
    @Autowired
    private IChessService chessService;

    /**
     * 象棋对战版
     *
     * @return
     */
    @RequestMapping("/toChess")
    public ModelAndView toChessCp() {
        return new ModelAndView("chess/chess");
    }

    /**
     * 揭棋
     *
     * @return
     */
    @RequestMapping("/toJq")
    public ModelAndView toJq() {
        return new ModelAndView("/chess/jq/jq");
    }

    /**
     * 获取在线用户
     *
     * @return
     */
    @RequestMapping("/getOnlineUser")
    public ResponseEntity<ModelMap> getOnlineUser() {
        return ResponseEntity.ok(chessService.getOnlineUser());
    }

    /**
     * 获取在线用户
     *
     * @return
     */
    @RequestMapping("/getJqOnlineUser")
    public ResponseEntity<ModelMap> getJqOnlineUser() {
        return ResponseEntity.ok(chessService.getJqOnlineUser());
    }
}
